import request from '@/config/axios'

export interface PurchaseVO {
  id: number
  companyId: number
  projectId: number
  goodsId: number
  needNumber: number
  endNumber: number
  province: string
  city: string
  area: string
  address: string
  lon: string
  lat: string
  startTime: Date
  endTime: Date
}

// 查询采购计划管理列表
export const getPurchasePage = async (params) => {
  return await request.get({ url: `/system/purchase/page`, params })
}

// 查询采购计划管理详情
export const getPurchase = async (id: number) => {
  return await request.get({ url: `/system/purchase/get?id=` + id })
}

// 新增采购计划管理
export const createPurchase = async (data: PurchaseVO) => {
  return await request.post({ url: `/system/purchase/create`, data })
}

// 修改采购计划管理
export const updatePurchase = async (data: PurchaseVO) => {
  return await request.put({ url: `/system/purchase/update`, data })
}

// 删除采购计划管理
export const deletePurchase = async (id: number) => {
  return await request.delete({ url: `/system/purchase/delete?id=` + id })
}

// 导出采购计划管理 Excel
export const exportPurchase = async (params) => {
  return await request.download({ url: `/system/purchase/export-excel`, params })
}
